@extends('admin.layout.main')
@section("content")
    <form class="layui-form" action="/admin/task/update/{{$task->id}}" method="post">
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>任务修改</legend>
        </fieldset>
        <div class="layui-form-item">
            <label class="layui-form-label">任务名称</label>
            <div class="layui-input-block">
                <input type="text" name="name" value="{{$task->name}}" autocomplete="off" placeholder="请输入标题" class="layui-input">

            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">任务分类</label>
            <div class="layui-input-inline">
                <select name="type_id" >
                    <option value="{{$task->type_id}}">{{$task->type_name}}</option>
                    <optgroup label="分类">
                        @foreach($types as $type)
                            <option value="{{$type->id}}">{{$type->name}}</option>
                        @endforeach
                    </optgroup>
                </select>
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">任务具体内容</label>
            <div class="layui-input-block">
                <textarea placeholder="请输入内容"  name="task_content" class="layui-textarea">{{$task->task_content}}</textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">分配用户</label>
                <div class="layui-input-inline">
                    <select name="user_id">
                        <option value="{{$task->user_id}}">{{$task->user_name}}</option>
                        <optgroup label="员工">
                            @foreach($users as $user)
                                <option value="{{$user->id}}">{{$user->name}}</option>
                            @endforeach
                        </optgroup>
                    </select>
                </div>
            </div>
        </div>

        <div class="layui-inline">
            <label class="layui-form-label">时间区间</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" value="{{$task->start_time.' 到 '.$task->end_time}}" name="datetime" id="test16" placeholder="开始 到 结束">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">任务状态</label>
                <div class="layui-input-inline">
                    <select name="task_state">
                        <option value="{{$task->task_state}}">{{$task->task_state}}</option>
                        <optgroup label="员工">
                            <option value="0">失败</option>
                            <option value="1">正在进行</option>
                            <option value="2">成功</option>
                        </optgroup>
                    </select>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
@endsection
